﻿using System;
using Transformable_Engine_v2.Engine.Network.Interfaces;

namespace Platformer_Example.Controller.Network.Messages
{
    public class JoinGameAcceptResponse : INetworkSerializable
    {
        public const int ID = 5;
        public int Id
        {
            get { return ID; }
            set { } //Not used. Leave there to make deserialization possible
        }

        public string NetworkId { get; set; }
        public string MapName { get; set; }
        public string[] Teams { get; set; }
        public string[] PlayersNames { get; set; }

        public override string ToString()
        {
            string teamString = "";
            int mult = PlayersNames.Length/Teams.Length;
            for (int i = 0; i < Teams.Length; i++)
            {
                teamString += string.Format("Team #{0} - {1}\n", i, Teams[i]);
                for (int j = 0; j < mult; j++)
                {
                    teamString += string.Format("     {0}\n", PlayersNames[i*mult + j]);
                }
            }

            return string.Format("Id: {0}\nMap name: {1}\n{2}", NetworkId, MapName, teamString);
        }
    }
}